home *** CD-ROM | disk | FTP | other *** search
/ Acorn User: China / Acorn User China CD-ROM (UK) (Disc B) / Acorn User China CD-ROM (UK) (Disc B).bin / STUTTGART / ETC / AIM / !aim_macros_demtable8 < prev    next >
Encoding:
Text File  |  1990-08-30  |  1.5 KB  |  60 lines

  1. * @demtable demonstrates the table command.
  2. * table: transforms a grey value image using a look-up table.
  3. *
  4. * The grey value g from the input image (first parameter) is used 
  5. * as table address,  the content found there becomes the grey value 
  6. * h in the output image (second parameter).
  7. shad a
  8. copy a b 1 1 0 1 1 0 
  9. *transposed
  10. * Several tables can  be generated (third parameter, t):
  11. * t=0: (h/255)=(g/255)**(j/k);    
  12. table a d 0 1 2  
  13. * j/k=1/2, power, square root 
  14. add b d 
  15. th d d 1 127
  16. table a d 0 2 1  
  17. * j/k=2/1, power, square 
  18. add b d 
  19. th d d 1 127
  20. * t=0: (h/255)=g**(j/k), for j/k<0 different scaling: g instead of g/255;    
  21. table a d 0 -1 1  
  22. * j/k=-1/1, neg.power 
  23. add b d 
  24. th d d 1 127
  25. * t=2: (h/255)=(k/g)**j;
  26. table a d 2 1 1  
  27. * 255/g, reciprocal 
  28. add b d 
  29. th d d 1 127
  30. * t=1: (h/255)=(j/k)**((g/255)-1);   j=0 -> j/k=e;
  31. table a d 1 10 1  
  32. * exponential, base 10 
  33. add b d 
  34. th d d 1 127
  35. table a d 1 0 1  
  36. * exponential, base e 
  37. add b d 
  38. th d d 1 127
  39. * t=-1: (h/255)-1=log(g/255)/log(j/k); 
  40. table a d -1 10 1 1 
  41. * logarithm, base 10 
  42. add b d 
  43. th d d 1 127
  44. table a d -1 0 1 1 
  45. * logarithm, base e 
  46. add b d 
  47. th d d 1 127
  48. * t=3: pi2 (h-127-j)/127=atan((k/100) pi2 (g-127)/128  - tan(pi2 j/127)); pi2=pi/2;
  49. * t=3:      h           =atan((k/100)      g           -  (k/100) gj   );    
  50. table a d 3 0 100 1
  51. * arctangent S-curve
  52. add b d 
  53. th d d 1 127
  54. * t=-3: pi2 (h-127)/128=(tan(pi2 (g-127-j)/127)+tan(pi2 j/127)) /(k/100); pi2=pi/2;
  55. * t=-3:      h         =(tan     (g    -j)     +   (k/100) gj ) /(k/100);
  56. table a d -3 0 100 1
  57. * tangent inverse S-curve
  58. add b d
  59. th d d 1 127
  60.